<html>
<head><meta charset="utf-8"><title>How to build rust-lld in CI · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html">How to build rust-lld in CI</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="241407869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241407869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kevin Tran <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241407869">(Jun 03 2021 at 15:31)</a>:</h4>
<p>On my machine, I've set <code>lld=true</code> in my <code>config.toml</code>, and so the path <code>build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin</code> contains <code>rust-lld</code>. However, when my PR is built in CI, it fails because <code>build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin</code> does not contain <code>rust-lld</code>. How can I build <code>rust-lld</code> in CI?</p>



<a name="241409231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241409231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241409231">(Jun 03 2021 at 15:40)</a>:</h4>
<p>It's probably a rustup component</p>



<a name="241409270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241409270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241409270">(Jun 03 2021 at 15:40)</a>:</h4>
<p>Llvm-tools-preview maybe. As name suggests it isn't stable.</p>



<a name="241409326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241409326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241409326">(Jun 03 2021 at 15:41)</a>:</h4>
<p>Ah hm, probably answered about the wrong thing.</p>



<a name="241409647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241409647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241409647">(Jun 03 2021 at 15:43)</a>:</h4>
<p>I guess that would simply mean we don't have a need to build it, maybe only do so in dist. Why do you need lld specifically?</p>



<a name="241410141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241410141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kevin Tran <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241410141">(Jun 03 2021 at 15:46)</a>:</h4>
<p>I'm testing rust-lld support in this PR <a href="https://github.com/rust-lang/rust/pull/85961">https://github.com/rust-lang/rust/pull/85961</a> :P <span class="user-mention" data-user-id="123586">@nagisa</span></p>



<a name="241414756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241414756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241414756">(Jun 03 2021 at 16:20)</a>:</h4>
<p>you _may_ need a fulldeps make test for this, but not sure.</p>



<a name="241417717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241417717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kevin Tran <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241417717">(Jun 03 2021 at 16:42)</a>:</h4>
<p>Actually, I'm not even sure which copy of <code>rust-lld</code> I should be using: the one built in the project dir, or the one in the rustup toolchain.</p>



<a name="241419371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241419371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241419371">(Jun 03 2021 at 16:55)</a>:</h4>
<p>For tests of rustc, the one built in the project dir. rustup does not come in play in anyway for the purposes of rustc build system.</p>



<a name="241427651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241427651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241427651">(Jun 03 2021 at 17:49)</a>:</h4>
<p>AFAIK <code>rust-lld</code> isn't built for the  most of the test builders. There are a few that require it (like test-various). It is usually only built for dist builders.</p>
<p>I would maybe suggest picking a linux builder and adding <code>--enable-lld</code>, and teach compiletest to ignore the test if rust-lld isn't available. But that is a decision maybe infra would want to weigh in on.  Building lld is pretty fast, though.</p>



<a name="241497617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241497617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kevin Tran <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241497617">(Jun 04 2021 at 07:01)</a>:</h4>
<p>Sorry, what's a test builder, and where can I add <code>--enable-lld</code>?</p>



<a name="241524575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241524575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241524575">(Jun 04 2021 at 11:56)</a>:</h4>
<p>Ah, not sure how familiar you are with the rust-lang CI.  There are about 60 jobs which each build either for distribution ("dist") or for running tests (or sometimes both!).  <a href="https://github.com/rust-lang-ci/rust/actions/runs/905427730">Here</a> is a link to a recent run where you can see a list of their names.  They are defined in <a href="https://github.com/rust-lang/rust/blob/master/.github/workflows/ci.yml">ci.yml</a>.  Most of them are docker images.  Probably one of the most basic ones that runs tests is <a href="https://github.com/rust-lang/rust/blob/master/src/ci/docker/host-x86_64/x86_64-gnu/Dockerfile">x86_64-gnu</a>.  The Dockerfile is where the per-job settings are set. You can search through the other docker files to see an example like <a href="https://github.com/rust-lang/rust/blob/c4c2ab57a43737867982fafc8cfacd9b069fee96/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile#L37">this</a> where <code>--enable-lld</code> is set.  You would just need to add that to one of the docker files that runs the tests you are writing. I think x86_64-gnu is maybe a good choice, since it is basic and runs fairly fast (~40 minutes). It is important to consider how long each job runs.</p>
<p>There is some documentation <a href="https://rustc-dev-guide.rust-lang.org/tests/intro.html#testing-with-docker-images">here</a> for running the docker images locally if you want to test out your changes.</p>



<a name="241529248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241529248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kevin Tran <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241529248">(Jun 04 2021 at 12:40)</a>:</h4>
<p><span class="user-mention" data-user-id="120518">@Eric Huss</span>  I see that mingw-check, x86_64-gnu-llvm-10, and x86_64-gnu-tools is run on my PR, but not x86_64-gnu. How do I run x86_64-gnu?</p>



<a name="241530119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241530119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241530119">(Jun 04 2021 at 12:49)</a>:</h4>
<p>If you would prefer to try it out via CI, you can temporarily add it to the "pr" list in <a href="https://github.com/rust-lang/rust/blob/master/.github/workflows/ci.yml"><code>ci.yml</code></a>. Just copy and paste the <code>x86_64-gnu</code> job next to the other three, and run the instructions at the top of the file to regenerate the ci.yml file.  Just be sure to remove it once you have verified it is working properly.</p>



<a name="241544899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241544899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kevin Tran <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241544899">(Jun 04 2021 at 14:38)</a>:</h4>
<p>Huh, adding <code>enable-lld</code> to <code>x86_64-gnu</code> works since cmake is up to date, but not on <code>x86_64-gnu-llvm-10</code>. I'm guessing this is because the former runs ubuntu 20.04 and the latter runs 18.04? Is there anything I could do to update cmake on the latter, or do I just have to ignore the latter somehow?</p>



<a name="241552006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241552006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241552006">(Jun 04 2021 at 15:27)</a>:</h4>
<p>I think the test will need to be able to ignore any situation where lld doesn't exist, so I wouldn't bother trying to get lld to build on gnu-llvm-10.</p>



<a name="241563116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241563116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kevin Tran <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241563116">(Jun 04 2021 at 16:49)</a>:</h4>
<p>How would I ignore such a test? <a href="https://rustc-dev-guide.rust-lang.org/tests/adding.html#ignoring-tests">https://rustc-dev-guide.rust-lang.org/tests/adding.html#ignoring-tests</a> doesn't seem to have anything relevant. <span class="user-mention" data-user-id="120518">@Eric Huss</span></p>



<a name="241563438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241563438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241563438">(Jun 04 2021 at 16:51)</a>:</h4>
<p>You'd need to teach compiletest how to do that.  That would probably involve adding a new header (like one of the <code>needs-...</code> headers).  The headers are in <a href="https://github.com/rust-lang/rust/blob/master/src/tools/compiletest/src/header.rs">https://github.com/rust-lang/rust/blob/master/src/tools/compiletest/src/header.rs</a>.</p>



<a name="241570177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241570177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kevin Tran <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241570177">(Jun 04 2021 at 17:43)</a>:</h4>
<p>How does RUST_CONFIGURE_ARGS work? In particular, I'm interested where the <code>enable-lld</code> flag affects the compilation of rust-lld.</p>



<a name="241575260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20to%20build%20rust-lld%20in%20CI/near/241575260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20to.20build.20rust-lld.20in.20CI.html#241575260">(Jun 04 2021 at 18:26)</a>:</h4>
<p>The default CI script is <a href="https://github.com/rust-lang/rust/blob/master/src/ci/run.sh"><code>run.sh</code></a> which passes <code>RUST_CONFIGURE_ARGS</code> to the <a href="https://github.com/rust-lang/rust/blob/master/configure"><code>configure</code></a> script which essentially just stores those settings in <code>config.toml</code>.  <code>x.py</code> reads the config, and the code that builds lld is around <a href="https://github.com/rust-lang/rust/blob/595088d602049d821bf9a217f2d79aea40715208/src/bootstrap/native.rs#L524-L616">here</a>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>